# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: James Fryman <jfryman@gmail.com>

pkgname=libdnet
pkgver=1.17.0
pkgrel=1
pkgdesc='A simplified, portable interface to several low-level networking routines'
arch=('loong64' 'x86_64')
checkdepends=('check')
license=('BSD')
url='https://github.com/ofalk/libdnet'
source=("https://github.com/ofalk/${pkgname}/archive/${pkgname}-${pkgver}.tar.gz")
sha256sums=('6be1ed0763151ede4c9665a403f1c9d974b2ffab2eacdb26b22078e461aae1dc')

prepare() {
  cd "$srcdir"/$pkgname-$pkgname-$pkgver

  autoreconf -I config --force --install
}

build() {
  cd "$srcdir"/$pkgname-$pkgname-$pkgver

  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin
  make
}

check() {
  cd "$srcdir"/$pkgname-$pkgname-$pkgver

  # fails in build container
  #make check
}

package() {
  cd "$srcdir"/$pkgname-$pkgname-$pkgver

  make DESTDIR="$pkgdir/" install

  install -D -m0644 LICENSE "$pkgdir"/usr/share/licenses/libdnet/license
}
